<{extends file="<{$tempdir}>/public/wxsite.html"}>
<{block name=extendjs}>
<script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/template.min.js"></script>
<script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/wxshop.js"></script>
<script src="<{$siteurl}>/templates/<{$tempdir}>/public/wxsite/js/cart.js"></script>
<script src="<{$siteurl}>/js/Swiper/idangerous.swiper.js"></script>
<link rel="stylesheet"  href="<{$siteurl}>/js/Swiper/idangerous.swiper.css">

<script>
    var myScroll;
    function loaded() {
        myScroll = new iScroll('wrapper', {
            useTransform: false,
            onBeforeScrollStart: function (e) {
                var target = e.target;
                while (target.nodeType != 1) target = target.parentNode;

                if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
                    e.preventDefault();
            }
        });
    }
    document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
    document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false);
</script>
<script>
    var shopid = "<{$shopinfo['id']}>";
    var is_goshop = "<{$shopdet['is_goshop']|default:0}>";
    var checknext = false;
    var shoplimitcost = "<{$shopdet['limitcost']}>";
    var zuocart = '<{$siteurl}>/index.php?ctrl=wxsite&action=gowei&id=<{$id}>';
    function myyanchi(){

        checknext = false;
    }
    function sortitemclick(doid,obj){
        // var scroptop= $('#listto_'+doid).offset().top-40;// checktype == '1'?Number($("#sort_sh_"+doid).offset().top)-81:Number($("#sort_sh_"+doid).offset().top)-162;
        // alert(doid);
        //right_list

        var defaultheight = 0;
        var listobj = $('.right_list_box');
        for(var i=0;i<$(listobj).length;i++){

            if($(listobj).eq(i).attr('data') == doid){

                break;
            }else{
                defaultheight = Number(defaultheight)+Number($(listobj).eq(i).height());
            }
        }
        $(obj).addClass('on').siblings().removeClass('on');
        scroll2.scrollTo(0,Number(defaultheight)*-1,200,false);

    }



    //添加店铺收藏
    function myFavorite(shopid,obj)
    {
        var url = siteurl+'/index.php?ctrl=shop&action=addcollect&datatype=json&collectid='+shopid+'&type=0';
        var backinfo = ajaxback(url,{});
        if(backinfo.flag == false){
            $(obj).hide();
            $(obj).next().show();
            //	$('#CancelFavShop').show();
        }else{
            Tmsg(backinfo.content);
        }
    }
    //删除店铺收藏
    function delFav(shopid,obj)
    {
        var url = siteurl+'/index.php?ctrl=shop&action=delcollect&datatype=json&collectid='+shopid+'&type=0';
        var backinfo = ajaxback(url,{});
        if(backinfo.flag == false){
            $(obj).hide();
            $(obj).prev().show();
            // $('#CancelFavShop').hide();
        }else{
            Tmsg(backinfo.content);
        }
    }
    function appendhtml(append,elmid){

        $('#outdivshow').css({'height':kuangheight});
//     myScroll = new iScroll('outdivshow', {hScrollbar:false, vScrollbar:true,bounce:false});

    }
    function checkshoprealimg(realid){
        myScroll.scrollToElement('.sjsjdiv',100);
        myScroll.destroy();
        $('#mask1').show();
        $('#popup1').show();
        $('.ordeilpaymenCon').css('z-index',99);
        var allheight = $(window).height();
//     alert(c1);
//     var top = $(elmid).offset().top;//元素相对于窗口的上边的偏移量
//     alert(c2);
        allheight = Number(allheight)-100;
//     alert(c3);
//     top = Number(top)+40;
//     alert(1);
//     var  kuangheight = allheight/1.5;
        var kheight  =(allheight/1.5)/2;
        var selfH=$('#popup1').height();
        $('#popup1').css({'top':'50%'});
//     $('#popup1').css({'margin-top':-selfH});
//     alert(20000);
        $('#popup1').css({'margin-top':-kheight});
        var url = siteurl+'/index.php?ctrl=wxsite&action=showshoprealimg';
        $.post(url, {'parent_id':realid},function (data, textStatus){
            $('#popup1').html(data);
        }, 'html');
    }

    function huisubshow(){
        var shopid=$("#shopid").val();
        window.location.href=siteurl+"/index.php?ctrl=wxsite&action=huisubshow&id="+shopid;
    }

</script>
<{/block}>
<{block name=hearnav}>
<div class="toptitCon">
    <div class="toptitBox">
        <div class="toptitL"><i></i></div>
        <div class="toptitC"><h3 style="font-size:16px;"><{$shopinfo['shopname']}></h3></div>

        <div <{if !empty($collect) }>style="display:none;"<{/if}>  onclick="myFavorite(<{$shopinfo['id']}>,this); "    class="toptitR"><i class="ordiscoll"></i></div>
    <div <{if empty($collect) }>style="display:none;"<{/if}>  onclick="delFav(<{$shopinfo['id']}>,this);"   class="toptitR"><i class="ordiscoll1"></i></div>

</div>
</div>
<{/block}>
<{block name=sitetitle}><{$sitename}><{/block}>
<{block name=blockcontent}>

<div id="wrapper">
    <div id="scroller">



        <!--商铺信息-->
        <div class="businessinfoCon">
            <div class="businessinfoBox">
                <ul class="businessinfo">
                    <li><img src="<{$shopinfo['shoplogo']|default:$shoplogo}>"></li>
                    <li>
                        <ul>
                            <li><h3><{$shopinfo['shopname']}></h3></li>
                            <li><{section name=loop loop=$shopstart }><i class="fa fa-star"></i><{/section}><{section name=loop loop=5-$shopstart }><i class="fa fa-star" style="color:#C7C7C7;"></i><{/section}></li>
                            <li><span>起送价<{$shopdet['limitcost']}>元 | 配送费<{$psinfo['pscost']}>元</span></li>
                        </ul>
                    </li>
                    <input type="hidden" id="shopid" value="<{$shopinfo['id']}>"/>
                    <div type="button"  onclick="huisubshow();" class="busBtn">优惠买单</div>
                </ul>
            </div>
        </div>
        <!--地址营业时间-->
        <div class="businessaddtim">
            <ul>
                <li><i class="businadd"></i><p><{$shopinfo['address']|default:'暂无填写商家地址'}></p></li>
                <li><i class="busintime"></i><p>营业时间：<{$shopinfo['starttime']}></p></li>
            </ul>
        </div>
        <div class="busWelfCon">
            <ul>
                <{if !empty($shophui) }>
                <li>
                    <i class="icon-jm"></i>
                    <p><{$shophui['name']}></p>
                </li>
                <{/if}>
            </ul>
        </div>
        <!--商家实景-->
        <style type="text/css">
            .sjsjdiv{float:left;width:23%;height:70px;margin-left:6px;position:relative;}
            .sjsjspan1{position:relative;background:#000;color:#fff;width:35px; opacity: 0.5;display:block;font-size:12px;text-align:center;}
            .sjsjspan2{position:absolute;background:#000;color:#fff;width:30px;bottom:0;right:0; opacity: 0.5;display:block;font-size:12px;height:20px;}
            .businessinfoBox .businessinfo li ul li span{
                font-size:12px;
            }
            .popup1 {
                display: block;
                position: fixed;
                z-index: 667;
                background: #fff;
                border: 1px solid #e5e5e5;
                -webkit-box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
                -moz-box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
                box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
                width: 100%;
            }
            #mask1 {
                background: none repeat scroll 0 0 #000000;
                height: 100%;
                opacity: 0.8;
                position: fixed;
                width: 100%;
                z-index: 666;
                left: 0px;
                top: 0px;
                display: none;
            }
            .busWelfCon{
                width: 100%;

                background: #fff;
            }

            .busWelfCon ul li{
                padding: 0 2.7777%;
                line-height: 36px;
                border-bottom: 1px solid #cccccc;
            }

            .busWelfCon ul li .icon-jm{
                width: 16px;
                height: 16px;
                display: inline-block;
                vertical-align: -2px;
            }

            .busWelfCon ul li p{
                font-size:12px;
                color: #ff3b30;
                display: inline-block;
            }
            .businessaddtim{
                border:none;
            }
            .businnotbrief{
                font-size: 14px;
                color: #000;
                line-height: 26px;
                text-align: justify;
            }
            .businessinfo .busBtn {
                width: 89px;
                height: 36px;
                font-size: 14px;
                color: #ffffff;
                background: #ff6e6e;
                border-radius: 4px;
                position: absolute;
                right: 10px;
                top:50px;
                line-height: 40px;
                text-align: center;
            }
        </style>

        <div class="businnotCon">
            <div class="businnotBox">
                <div class="businnotit"><h3>商家实景</h3></div>
                <div class="businnot">

                    <!--<{load_data assign="detlist" table="shoptype"    where="parent_id='215'"  orderby="id asc" limit="4" }>-->
                    <{foreach from=$shopreal key=key item =items}>
                    <{if !empty($items['shoprealimg'])}>
                    <div class="sjsjdiv" onclick="checkshoprealimg(<{$items['id']}>)" style="background:url(<{$items['shoprealimg'][0]['img']}>);background-size:100% 100%;">
                        <span class="sjsjspan1"><{$items['name']}></span>
                        <span class="sjsjspan2" align="center"><{$items['imgcount']}>张</span>
                    </div>
                    <{/if}>
                    <{/foreach}>

                </div>
            </div>
        </div>
        <script>
            $(function(){
                $("#mask1").click(function(){
                    $("#mask1").hide();
                    $("#popup1").hide();

                    myScroll.destroy();
                    myScroll = new iScroll('wrapper', {
                        useTransform: false,
                        onBeforeScrollStart: function (e) {
                            var target = e.target;
                            while (target.nodeType != 1) target = target.parentNode;

                            if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
                                e.preventDefault();
                        }
                    });

                });
                $("#popup1").click(function(){
                    $("#mask1").hide();
                    $("#popup1").hide();

                    myScroll.destroy();
                    myScroll = new iScroll('wrapper', {
                        useTransform: false,
                        onBeforeScrollStart: function (e) {
                            var target = e.target;
                            while (target.nodeType != 1) target = target.parentNode;

                            if (target.tagName != 'SELECT' && target.tagName != 'INPUT' && target.tagName != 'TEXTAREA')
                                e.preventDefault();
                        }
                    });


                });






            });

        </script>


        <!--商家公告-->
        <{if !empty($shopinfo['notice_info']) }>
        <div class="businnotCon">
            <div class="businnotBox">
                <div class="businnotit"><h3>商家公告</h3></div>
                <div class="businnot"><i></i><p><{$shopinfo['notice_info']|htmlspecialchars_decode}></p></div>
            </div>
        </div>
        <{/if}>
        <!--商家活动-->

        <!--商家简介-->
        <div class="businnotCon">
            <div class="businnotBox">
                <div class="businnotit"><h3>商家简介</h3></div>
                <div class="businnotbrief"><{$shopinfo['intr_info']|htmlspecialchars_decode|default:'暂无说明'}></div>
            </div>
        </div>
        <div style="height:10px;"></div>
        <!--------------------------------------------------------------------------商家结束-------------------------------------------------------------------------------------->
    </div></div>




<div id="mask1">
</div>
<div id="popup1" class="popup1" style="background:none; border:none;">
    <!--<div class="popcontent" id="popcontent" style="width:70%;margin:0 auto;">



    </div>-->
</div>



<{/block}>
